package com.example.lib_base.base.utils;

import com.orhanobut.logger.CsvFormatStrategy;
import com.orhanobut.logger.FormatStrategy;

/**
 * @author rxxu
 */
public class LogAdapter implements com.orhanobut.logger.LogAdapter {

    private final FormatStrategy formatStrategy;

    private boolean logIsAble = false;

    public LogAdapter() {
        formatStrategy = CsvFormatStrategy.newBuilder().build();
    }

    public LogAdapter(FormatStrategy formatStrategy) {
        this.formatStrategy = formatStrategy;
    }

    @Override
    public boolean isLoggable(int priority, String tag) {
        return logIsAble;
    }

    @Override
    public void log(int priority, String tag, String message) {
        formatStrategy.log(priority, tag, message);
    }

    public boolean isLogIsAble() {
        return logIsAble;
    }

    public void setLogIsAble(boolean logIsAble) {
        this.logIsAble = logIsAble;
    }
}
